var swiper = new Swiper(".mySwiper", {
    loop:true,
	autoplay: {
		delay: 4000,
    },
	navigation: {
		nextEl: ".swiper-button-next",
		prevEl: ".swiper-button-prev",
	},
    pagination: {
      el: ".swiper-pagination",
	  clickable :true,
    },on:{
			init:function(swiper){
		        slide=this.slides.eq(0);
			    slide.addClass('swiper-actives');
		    },
			transitionStart: function(){
			    for(i=0;i<this.slides.length;i++){
			    	slide=this.slides.eq(i);
			        slide.removeClass('swiper-actives');
				}
		    },
			transitionEnd: function(){
				slide=this.slides.eq(this.activeIndex);
			    slide.addClass('swiper-actives');
				
		    },
		}
  });


  $(".nav-li").on('mouseenter',function(){
    $(".left-subs-li").removeClass("left-subs-li-active");
    $(".left-subs-li1").addClass("left-subs-li-active")
})


$(".left-subs-li").on("mouseenter",function(){
	$(".left-subs-li").removeClass("left-subs-li-active");
    $(".left-subs-li1").addClass("left-subs-li-active")
}).mouseover(function(){
	if ($(this).hasClass("left-subs-li-active")){
        return;
    }else{
        $(".left-subs-li").removeClass("left-subs-li-active");
        $(this).addClass("left-subs-li-active")
    }
})

$(".change-li").on('click',function(){
	$(".change-li").removeClass('change-li-active')
	$(this).addClass("change-li-active")
	$(".prodcuts").removeClass("prodcuts-active")
	let ids = $(this).attr('id')
	$("#product-"+ids).addClass('prodcuts-active')
})

$(document).ready(function() {
	$(window).scroll(function() {
	  var scrollDistance = $(window).scrollTop();
	  var showDistance = 300; // 设置滚动距离阈值，控制何时显示元素

	  if (scrollDistance > showDistance) {
		$(".mobs-nav").addClass('mobs-nav-active');
	  } else {
		$(".mobs-nav").removeClass('mobs-nav-active');
	  }
	});
});

var newst = new Swiper(".newSwiper",{
    // 自动切换
    autoplay: {
      delay: 5000,
      disableOnInteraction: false,
    },
    // 循环
    loop: true,
    pagination: {
        el: ".swiper-pagination",
        clickable: true,
    }
})
